From: Jim Blandy Date: Wed, 16 Jun 1993 20:31:01 +0000 (+0000) Subject: * sysdep.c (closedir): Don't free directory buffer if it looks X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~95300 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=1b929d2579bbd362e094f1087776a67dbbb8afea;p=emacs.git * sysdep.c (closedir): Don't free directory buffer if it looks like it and the DIR were malloced together. --- diff --git a/src/sysdep.c b/src/sysdep.c index e696cb3d352..2bbdf2640f2 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2927,7 +2927,11 @@ closedir (dirp) register DIR *dirp; /* stream from opendir */ { sys_close (dirp->dd_fd); - xfree ((char *) dirp->dd_buf); /* directory block defined in */ + + /* Some systems allocate the buffer and the DIR all in one block. + Why in the world are we freeing this ourselves anyway? */ + if (dirp->dd_buf != (char *)(dirp + 1)) + xfree ((char *) dirp->dd_buf); /* directory block defined in */ xfree ((char *) dirp); } #endif /* not AIX */